Optimal. Leaf size=66 \[ \frac {i \, _2F_1\left (3,n;1+n;\frac {1}{2} (1-i \tan (e+f x))\right ) (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-n}}{8 a^2 f n} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.14, antiderivative size = 66, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3586, 3603,
3568, 70} \begin {gather*} \frac {i (a+i a \tan (e+f x))^{-n} (d \sec (e+f x))^{2 n} \, _2F_1\left (3,n;n+1;\frac {1}{2} (1-i \tan (e+f x))\right )}{8 a^2 f n} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 70
Rule 3568
Rule 3586
Rule 3603
Rubi steps
\begin {align*} \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-2-n} \, dx &=\left ((d \sec (e+f x))^{2 n} (a-i a \tan (e+f x))^{-n} (a+i a \tan (e+f x))^{-n}\right ) \int \frac {(a-i a \tan (e+f x))^n}{(a+i a \tan (e+f x))^2} \, dx\\ &=\frac {\left ((d \sec (e+f x))^{2 n} (a-i a \tan (e+f x))^{-n} (a+i a \tan (e+f x))^{-n}\right ) \int \cos ^4(e+f x) (a-i a \tan (e+f x))^{2+n} \, dx}{a^4}\\ &=\frac {\left (i a (d \sec (e+f x))^{2 n} (a-i a \tan (e+f x))^{-n} (a+i a \tan (e+f x))^{-n}\right ) \text {Subst}\left (\int \frac {(a+x)^{-1+n}}{(a-x)^3} \, dx,x,-i a \tan (e+f x)\right )}{f}\\ &=\frac {i \, _2F_1\left (3,n;1+n;\frac {1}{2} (1-i \tan (e+f x))\right ) (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-n}}{8 a^2 f n}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(165\) vs. \(2(66)=132\).
time = 120.18, size = 165, normalized size = 2.50 \begin {gather*} -\frac {i 2^{-3+n} e^{2 i e} \left (e^{i f x}\right )^{-n} \left (\frac {e^{i (e+f x)}}{1+e^{2 i (e+f x)}}\right )^n \left (1+e^{2 i (e+f x)}\right )^3 \, _2F_1\left (3,3-n;4-n;1+e^{2 i (e+f x)}\right ) \sec ^{2-n}(e+f x) (d \sec (e+f x))^{2 n} (\cos (f x)+i \sin (f x))^{2+n} (a+i a \tan (e+f x))^{-2-n}}{f (-3+n)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 1.26, size = 0, normalized size = 0.00 \[\int \left (d \sec \left (f x +e \right )\right )^{2 n} \left (a +i a \tan \left (f x +e \right )\right )^{-2-n}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.02 \begin {gather*} \int \frac {{\left (\frac {d}{\cos \left (e+f\,x\right )}\right )}^{2\,n}}{{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^{n+2}} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________